/**
 * Copyright By Nanjing Fujitsu Nanda Software Technology Co., Ltd
 * 上午10:16:27
 * CoreRoleDao.java
 * 
 */
package com.fujitsu.nanjing.mobile.dao;

import com.fujitsu.nanjing.mobile.exception.NotOneException;
import com.fujitsu.nanjing.mobile.model.hibernate.CoreRole;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

/**
 * @author qixb.fnst
 * 
 */
@Repository
public class CoreRoleDao extends BaseDao<CoreRole> {

    /**
     * qixib.fnst
     * 
     * @param roleId
     * @return
     * @throws NotOneException 
     */
    public CoreRole getRoleByRoleId(int roleId) throws NotOneException {
        Session session = getSession();
        Criteria criteria = session.createCriteria(CoreRole.class).add(
                Restrictions.eq("roleId", roleId));
         return query4One(criteria);
    }

}
